package com.thinkgem.jeesite.modules.brain.common;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ExercType {
    //题型  0001单选题 0002多选题 0003判断题

   String typeName;
   String typeCode;

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public ExercType(String typeName, String typeCode) {
        this.typeName = typeName;
        this.typeCode = typeCode;
    }

    private  final static String  SINGECHOICE="singeChoice";

    private  final static String  JUDGMENT="judgment";

    private  final static String  MULTICHOICE="multiChoice";
    static Map<String,ExercType> entity=new ConcurrentHashMap<>(6);



    public static ExercType singeChoice(){
        if(null==entity.get(SINGECHOICE))
            synchronized (SINGECHOICE){
                 if(null==entity.get(SINGECHOICE))
                     entity.put(SINGECHOICE,new ExercType(SINGECHOICE,"0001"));
            }
        return entity.get(SINGECHOICE);
    }

    public static ExercType multiChoice(){
        if(null==entity.get(MULTICHOICE))
            synchronized (MULTICHOICE){
                if(null==entity.get(MULTICHOICE))
                    entity.put(MULTICHOICE,new ExercType(MULTICHOICE,"0002"));
            }
        return entity.get(SINGECHOICE);
    }

    public static ExercType judgment(){
        if(null==entity.get(JUDGMENT))
            synchronized (JUDGMENT){
                if(null==entity.get(JUDGMENT))
                    entity.put(JUDGMENT,new ExercType(JUDGMENT,"0003"));
            }
        return entity.get(JUDGMENT);
    }
}
